<?php
include"config.php";
		$one_day = $_POST['one_day'];
		$three_day = $_POST['three_day'];
		$seven_day = $_POST['seven_day'];
		$thirty_day = $_POST['thirty_day'];
	
		$id = $_POST['id'];
		$namafolder="assets/picture/";
		$char_name=$_POST['char_name'];
		$cattegory = $_POST['cattegory'];
		$mark = $_POST['mark'];
		
		$description = $_POST['description'];
		$status = $_POST['status'];
				
		
			
		
			if (!empty($_FILES["picture"]["tmp_name"])){
				$jenis_gambar = $_FILES['picture']['type'];
				if($jenis_gambar=="image/jpeg" || $jenis_gambar=="image/jpg" || $jenis_gambar=="image/gif" || $jenis_gambar=="image/png"){
					//echo"a";
					$gambar = $namafolder . basename($_FILES['picture']['name']);
					$judul_gambarnya = $_FILES['picture']['name'];
					if (move_uploaded_file($_FILES['picture']['tmp_name'], $gambar)){
						//echo"b";
						$sql="update tbl_char set picture = '$judul_gambarnya', char_name = '$char_name', cattegory = '$cattegory', mark = '$mark', one_day = '$one_day', three_day = '$three_day', seven_day = '$seven_day', thirty_day = '$thirty_day',  description = '$description', status = '$status' where id_char = '$id'";
						$res=mysql_query($sql) or die (mysql_error());
						
						header("location:index.php?page=char");
					}else{
						echo "Gambar gagal dikirim";
					}
				}else{
					echo "Jenis gambar yang anda kirim salah. Harus .jpg .gif .png";
			}
					}else{
						$sql="update tbl_char set char_name = '$char_name', cattegory = '$cattegory', mark = '$mark', one_day = '$one_day', three_day = '$three_day', seven_day = '$seven_day', thirty_day = '$thirty_day',  description = '$description', status = '$status' where id_char = '$id'";
						$res=mysql_query($sql) or die (mysql_error());
						
						header("location:index.php?page=char");
					}
?>